#ifndef BUCQUAGE_H
#define BUCQUAGE_H

#include <pg.h>
#include <statistiques.h>
#include <moneydelegate.h>
#include "moduleaccueil.h"
#include <promsmodel.h>
#include <qtedelegate.h>

#include <QWidget>
#include <QStringList>
#include <QMessageBox>
#include <QSqlQueryModel>
#include <QStandardItemModel>
#include <QList>
#include <QSettings>

#include <QKeyEvent>

namespace Ui {
class Bucquage;
}

class Bucquage : public QWidget
{
    Q_OBJECT
    
public:
    explicit Bucquage(QWidget *parent = 0);
    ~Bucquage();
    
public slots:
    void setPg(Pg *p);
    void resetModels();

signals:
    void termine();

protected:
    void keyPressEvent(QKeyEvent *e);

private slots:

    void bucquer();

    void majListeConso();
    void majChoix();
    void ajouterConso(int i);
    void retirerConso(int i);
    void majHisto();

private:
    Ui::Bucquage *ui;
    Pg *pg;
    QString recherche;
    QSqlDatabase db;

    PromsModel *modelConsos;
    QStandardItemModel *modelChoix;
    MoneyDelegate *moneydelegate;

    QStringList consos;
    QList<int> nbConsos;
    QList<double> prixConsos;
    bool blocker;
    double limit;

    QString stylePos;
    QString styleNeg;
};

#endif // BUCQUAGE_H
